public class Solution1684 {
    public int countConsistentStrings(String allowed, String[] words) {
        boolean[] f=new boolean[26];
        for (char c : allowed.toCharArray()) {
            f[c-'a']=true;
        }
        int ans=0;
        for (String word : words) {
            boolean flag=true;
            for (char c : word.toCharArray()) {
                flag&=f[c-'a'];
            }
            if (flag){
                ans++;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1684().countConsistentStrings("ab",new String[]{"ad","bd","aaab","baa","badab"}));
    }
}
